package com.cjfan.trendplus.noteit;

import com.cjfan.trendplus.noteit.add.AddNewItemActivity;
import com.cjfan.trendplus.noteit.study.StudyActivity;
import com.cjfan.trendplus.noteit.wordbank.WordbankActivity;
import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.Toast;

public class NoteIT extends Activity {

	//ImageButton addNewIB;
	Button addNewBtn, studyBtn, wordbankBtn, flashcardsBtn, searchBtn, aboutBtn;
	
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_note_it);
              
	    addNewBtn = (Button) findViewById(R.id.addNewBtn);  
	    studyBtn = (Button) findViewById(R.id.studyBtn);
	    wordbankBtn = (Button) findViewById(R.id.wordbankBtn);
	    flashcardsBtn = (Button) findViewById(R.id.flashcardsBtn);
	    searchBtn = (Button) findViewById(R.id.searchBtn);
	    aboutBtn = (Button) findViewById(R.id.aboutBtn);
	    
	    addNewBtn.setOnClickListener(btnTrigger);
	    studyBtn.setOnClickListener(btnTrigger);
	    wordbankBtn.setOnClickListener(btnTrigger);
	    flashcardsBtn.setOnClickListener(btnTrigger);
	    searchBtn.setOnClickListener(btnTrigger);
	    aboutBtn.setOnClickListener(btnTrigger);
	    
    }
    
    private OnClickListener btnTrigger=new OnClickListener(){
		@Override
		public void onClick(View v) {
			switch(v.getId()){
				case R.id.addNewBtn:
				{
					Intent intentAddNewAction = new Intent();
					intentAddNewAction.setClass(NoteIT.this, AddNewItemActivity.class);
			    	startActivity(intentAddNewAction);
			    	NoteIT.this.finish();
				  	break;
				}
					
				case R.id.studyBtn:
				{
					Intent intentStudyAction = new Intent();
					intentStudyAction.setClass(NoteIT.this, StudyActivity.class);
			    	startActivity(intentStudyAction);
			    	NoteIT.this.finish();
					break;
				}
					
				case R.id.wordbankBtn:
				{
					Intent intentWB = new Intent();
					intentWB.setClass(NoteIT.this, WordbankActivity.class);
			    	startActivity(intentWB);
			    	NoteIT.this.finish();
					break;
				}
					
				case R.id.flashcardsBtn:
				{
					Toast.makeText(NoteIT.this,"flashcards建構中",Toast.LENGTH_LONG).show();
					break;
				}
					
				case R.id.searchBtn:
				{
					Toast.makeText(NoteIT.this,"search建構中",Toast.LENGTH_LONG).show();
					break;
				}
					
				case R.id.aboutBtn:
				{
					Toast.makeText(NoteIT.this,"about建構中",Toast.LENGTH_LONG).show();
					break;
				}
				default:
			}
		}
    };
}
